package com.jijs.jws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.BindingType;
import javax.xml.ws.Endpoint;

@WebService(endpointInterface="com.jijs.jws.IHello")
//@SOAPBinding(style=Style.RPC)	//RPC方式
public class Hello implements IHello{

	@WebMethod
	public String sayHello(String name) {
		String s = "Hello, " + name + "\n";
		System.out.println(s);
		return s;
	}
	
	public String sayGoodBye(String name){
		String s = "Good Bye :" + name;
		System.out.println(s);
		return s;
	}

	/**
	 * 生成客户端代码
	 * wsimport -p com.jijs.jws.client -keep http://localhost:8080/hello?wsdl
	 * 
	 * 客户端运行类 com.jijs.jws.client.HelloClient.java
	 * @param args
	 */
	public static void main(String[] args) {
		Hello hello = new Hello();
		Endpoint endpoint = Endpoint.publish("http://localhost:8080/hello", hello);
	}
}
